package com.ytjj.qmyx.users.model.response;

import com.ytjj.qmyx.users.enums.UserBalanceSourceEnums;
import com.ytjj.qmyx.users.enums.UserOperateRecordEnums;
import com.ytjj.qmyx.users.model.UsersBalanceRecord;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @Description 我的钱包明细
 *
 * @Version 1.0
 * 
 */

@Data
@Accessors(chain = true)
public class MyWalletInfoResponse {

    /**
     * 主键
     *
     * @mbg.generated
     */
    private Integer id;

    /**
     * 用户id
     *
     * @mbg.generated
     */
    private Integer userId;

    /**
     * 用户原余额
     *
     * @mbg.generated
     */
    private BigDecimal originalBalance;

    /**
     * 用户新余额
     *
     * @mbg.generated
     */
    private BigDecimal newBalance;

    /**
     * 流水类型 add加 sub减
     *
     * @mbg.generated
     */
    private String type;

    /**
     * 金额
     *
     * @mbg.generated
     */
    private BigDecimal balance;

    /**
     * 金额来源
     *
     * @mbg.generated
     */
    private String source;

    /**
     * 创建时间
     *
     * @mbg.generated
     */
    private Date createTime;

    public MyWalletInfoResponse() {

    }

    public MyWalletInfoResponse(UsersBalanceRecord usersBalanceRecord) {
        BeanUtils.copyProperties(usersBalanceRecord, this);
//        this.source = UserOperateRecordEnums.getAspectRecord(usersBalanceRecord.getSource());
        this.source = UserBalanceSourceEnums.getCodeDesc(usersBalanceRecord.getSource());
    }

}
